package com.bw.zg3.Log

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import com.alibaba.android.arouter.launcher.ARouter
import com.blankj.utilcode.util.SPUtils
import com.blankj.utilcode.util.ToastUtils
import com.bw.base.mvvm.BaseViewActivity
import com.bw.zg3.R
import com.bw.zg3.databinding.ActivityDjsactivityBinding
import dagger.hilt.android.AndroidEntryPoint
import java.util.Timer
@AndroidEntryPoint
class DJSActivity : BaseViewActivity<ActivityDjsactivityBinding>() {
    lateinit var timer: Timer
    val handler=Handler()
    var num=10

    override fun initView() {
//        if (SPUtils.getInstance().getBoolean("isFirst",false)){
//            ARouter.getInstance().build("/app/MainActivity").navigation()
//            finish()
//        }
        timer= Timer()
        timer.schedule(object :java.util.TimerTask(){
            override fun run() {
                handler.post {
                    binding.dj.text=num.toString()
                    if (num>0){
                        binding.dj.text=num.toString()
                        num--
                    }else{
                        timer.cancel()
                        ARouter.getInstance().build("/app/LogActivity").navigation()
                    }
                }
            }
        },0,1000)
    binding.dj.setOnClickListener {
        timer.cancel()
          ARouter.getInstance().build("/app/LogActivity").navigation()
}

    }

    override fun intiData() {
//        SPUtils.getInstance().put("isFirst",true)
    }
}